from django.db import models


class UserInfo(models.Model):
    username = models.CharField(max_length=32)
    password = models.CharField(max_length=64, default="")
    points = models.IntegerField(verbose_name="积分", default=0)
    articleNum = models.IntegerField(verbose_name="文章数据", default=0)


class Article(models.Model):
    title = models.CharField(max_length=64)
    content = models.TextField(blank=True, null=True)
    create_date = models.DateField(auto_now_add=True)
    create_date_time = models.DateTimeField(auto_now_add=True)
    user = models.ForeignKey(UserInfo, on_delete=models.CASCADE, default=None, blank=True, null=True)


class Token(models.Model):
    key = models.CharField(max_length=128)
    user = models.OneToOneField(UserInfo, default=None, on_delete=models.CASCADE)
